//
//  HCYOGvillageMap.m
//  YOGProj
//
//  Created by liyun on 14-7-21.
//  Copyright (c) 2014年 qkong. All rights reserved.
//

#import "HCYOGvillageMap.h"
#import "HCMacroDefinition.h"

@interface HCYOGvillageMap ()<UIWebViewDelegate>

@end

@implementation HCYOGvillageMap

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)navigationShowLeft
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = NSLocalizedString(@"HC青奥村地图", @"");
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame     = CGRectMake(0, 0, 30, 30);
    [button setBackgroundImage:[UIImage imageWithContentsOfFile:[BUNDLE pathForResource:@"HCback" ofType:@"png"]] forState:UIControlStateNormal];
    [button addTarget:self
               action:@selector(navigationShowLeft)
     forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *barItemleft          = [[UIBarButtonItem alloc]initWithCustomView:button];
    self.navigationItem.leftBarButtonItem = barItemleft;
    
    int height                  = (MODEL?568:480)-64;
    UIWebView *mapWeb = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, height)];
    mapWeb.delegate = self;
    mapWeb.scalesPageToFit = YES;
    mapWeb.userInteractionEnabled = YES;
    [self.view addSubview:mapWeb];
    [mapWeb loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[BUNDLE pathForResource:@"HCYOGvillage" ofType:@"pdf"]]]];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"HCTIP" object:@{@"HCmsg":NSLocalizedString(@"openFail", @"")}];
    NSLog(@"%@",error);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
